#!/bin/bash

echo "启动'今天随机吃什么'系统..."

echo ""
echo "1. 启动后台服务..."
cd backend
gnome-terminal --title="后台服务" -- bash -c "mvn spring-boot:run; exec bash" &
cd ..

echo ""
echo "等待后台服务启动..."
sleep 30

echo ""
echo "2. 启动管理界面..."
cd admin-frontend
gnome-terminal --title="管理界面" -- bash -c "npm install && npm run dev; exec bash" &
cd ..

echo ""
echo "3. 启动用户界面..."
cd user-frontend
gnome-terminal --title="用户界面" -- bash -c "npm install && npm run dev; exec bash" &
cd ..

echo ""
echo "系统启动完成！"
echo ""
echo "访问地址："
echo "后台服务: http://localhost:8080"
echo "管理界面: http://localhost:3000"
echo "用户界面: http://localhost:5173"
echo "H2控制台: http://localhost:8080/h2-console"
echo ""